package com.itheima.testswagger.controller;

import com.itheima.testswagger.pojo.Student;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.*;

/**
 * <h4>xc</h4>
 * <p></p>
 *
 * @author : by wujianming
 * @date : 2021-12-07 10:39
 **/
@Api(tags = "hello api测试服务", description = "对其提供接口")
public interface SwaggerApi {

    @ApiOperation("测试无参风格")
    @GetMapping("hello")
    String hello();

    @ApiOperation("测试queryString风格")
    @ApiImplicitParams({@ApiImplicitParam(name = "name", value = "学员名称", required = true, dataType = "String"
            , paramType = "query")})
    @GetMapping
    String queryString(@RequestParam("name") String name);

    @ApiOperation("测试path路径风格")
    //测试path(路径)风格的传参方式
    @GetMapping("{age}")
    String path(@PathVariable("age") String age);

    @ApiOperation("测试json风格")
    //Student数据
    //   }
    @PostMapping
    Student jsonStudent(@RequestBody Student student);

    @ApiOperation("测试组合风格")
    //测试queryString . path路径以及json格式的组合传参
    @PutMapping("{id}")
    @ApiImplicitParams({@ApiImplicitParam(name = "id", required = true, value = "学员的id", paramType = "query"),
                       @ApiImplicitParam(name = "name", value = "学员的名字", required = true, paramType = "query")})
    Student qPJStudent(@PathVariable("id") String id,
                       @RequestParam("name") String name,
                       @RequestBody Student student);
}
